/**
 * Created by Toai on 1/21/14.
 */
$(document).ready(function () {
    //Off-canvas menu
    $(".menu-btn").on('touchstart click', function (e) {
        e.preventDefault();
        $("#main-nav, #page_body").toggleClass("pageOpen");
        $("#hidden_nav").toggleClass("headerOpen");
        $(this).toggleClass("secondHeader-menuButton-active");
    });
    $(".menu_u_bnt").on('touchstart click', function (e) {
        e.preventDefault();
        $("#main-nav, #page_body").toggleClass("pageOpen_");
        $("#hidden_user_nav").toggleClass("headerOpen_");
        $(this).toggleClass("secondHeader-menuButton-active_");
    });

    $('.all').on('touchstart click', function () {
        $("#main-nav, #page_body").removeClass("pageOpen");
        $("#main-nav, #page_body").removeClass("pageOpen_");
        $('#hidden_nav').removeClass('headerOpen');
        $('#hidden_user_nav').removeClass('headerOpen_');
        $('.secondHeader-menuButton').removeClass("secondHeader-menuButton-active");
    });
//    Show more detail
    $('.content_detail .more_').click(function () {
        $('.content_book_des').css({"overflow": "inherit", "height": "auto"});
        $(this).hide();
        $('.content_detail .less_').show();
    });
    $('.content_detail .less_').click(function () {
        $('.content_book_des').css({"overflow": "hidden", "height": "281px"});
        $(this).hide();
        $('.content_detail .more_').show();
    });
    if ($('.content_book_des').height() > 282) {
        $('.content_detail').find('.more_').show();
    }
});